#ifndef tk_dlm_h__
#define tk_dlm_h__


#	ifdef LIB_EXPORTS
#		if defined(_MSC_VER)
#			define LIB_API __declspec(dllexport)
#		else
#			define LIB_API __attribute__((visibility("default")))
#		endif
#	else
#		if defined(_MSC_VER)
#			define LIB_API
#		else
#			define LIB_API
#		endif
#	endif

class Detector;

const static int C_SHARP_MAX_OBJECTS = 1000;

struct bbox_t {
	unsigned int x, y, w, h;       // (x,y) - top-left corner, (w, h) - width & height of bounded box
	//float objness;
	float prob;                    // confidence - probability that the object was found correctly
	unsigned int obj_id;           // class of object - from range [0, classes-1]
	unsigned int track_id;         // tracking id for video (0 - untracked, 1 - inf - tracked object)
	unsigned int frames_counter;   // counter of frames on which the object was detected
	float x_3d, y_3d, z_3d;        // center of object (in Meters) if ZED 3D Camera is used
};

struct image_t {
	int h = 0;							// height
	int w = 0;							// width
	int c = 0;							// number of chanels (3 - for RGB)
	float *data = 0;					// pointer to the image data   n * r + n*g + n*b
	float *data_dev = 0;
};

struct image_rgbf_t {
	int h = 0;							// height
	int w = 0;							// width
	int c = 0;							// number of chanels (3 - for RGB)
	float **data= 0;					// pointer to the image data   n * r + n*g + n*b
	float **data_dev = 0;
};

struct image_rgb8_t {
	int h = 0;							// height
	int w = 0;							// width
	int c = 0;							// number of chanels (3 - for RGB)
	unsigned char **data = 0;			// pointer to the image data   n * r + n*g + n*b
	unsigned char **data_dev = 0;
};

struct image_rgb16_t {
	int h = 0;							// height
	int w = 0;							// width
	int c = 0;							// number of chanels (3 - for RGB8)
	unsigned short **data = 0;			// pointer to the image data     n * r + n*g + n*b
	unsigned short **data_dev = 0;
};

struct bbox_t_container {
	bbox_t candidates[C_SHARP_MAX_OBJECTS];
};

class LIB_API tk_dlm
{
public:
	tk_dlm();
	~tk_dlm();

	bool Load(const char *config_file, const char *weight_file, int gpu = 0);

	void Release();
	//
	int Detect(image_rgbf_t img, bbox_t * p_result_boxs, float thresh = 0.2, bool use_mean = false);
	int Detect(image_rgb8_t img, bbox_t * p_result_boxs, float thresh = 0.2, bool use_mean = false);
	int Detect(image_rgb16_t img, bbox_t * p_result_boxs, float thresh = 0.2, bool use_mean = false);
	int Detect(const char * img_file, bbox_t * p_result_boxs, float thresh = 0.2, bool use_mean = false);

	//int Resize(image_rgb16_t img, image_t img_resize);
protected:
private:
	Detector * m_pdt;
};





#endif // tk_dlm_h__
